package com.atguigu.distributed.lock.redis.redisson;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author linjy on 2022/10/29
 */
@Configuration
public class RedissonConfig {

    @Bean
    public RedissonClient redissonClient() {
        Config config = new Config();

        config.useSingleServer()
                // 可以用"redis://"来启用SSL连接
                .setAddress("redis://172.16.116.100:6379")
                .setDatabase(0)
                //.setUsername()
                //.setPassword()
                //.setConnectionMinimumIdleSize()//连接池最小空闲连接数
                //.setConnectionPoolSize()//连接池的最大线程数
                //.setIdleConnectionTimeout(60000)//线程超时时间
                //.setConnectTimeout()//客户端程序获取redis链接的超时时间
                //.setTimeout()//响应超时时间
        ;
        return Redisson.create(config);
    }
}
